var events = require('events');
var layer = require('layer');
var suggest = require('./suggest');

return function(){
    return events(extend(this, {
        events:{
            'keydown .col-subject .cell-input':'enterTabBoard isChooseSubject nextFocus',
            'focus .col-subject .cell-input':'suggest',
            'click .j-subject':'chooseSubject'
        },
        isChooseSubject:function(e, elem, keycode){
            if(keycode === 9 && !elem.val()){
                layer.message('error', '请选择会计科目')
                return false
            }
        },
        suggest:function(e, elem){
            suggest.call(this, elem)
        },
        //科目按钮选择
        chooseSubject:function(e, elem){
            
            e.stopPropagation()
        }
    }))
}